Chris Pollett > Old Classses >
CS116a

( Print View )

Student Corner:
  [Grades Sec1]
  [Submit Sec1]
  [Class Sign Up Sec1]
  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Topics/Outcomes]
  [Outcomes Matrix]
  [Grading]
  [Class Protocols]
  [HW/Quiz Info]
  [Exam Info]
  [Regrades]
  [Honesty]
  [Additional Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]  [Quizzes]

Practice Exams:
  [Midterm]  [Final]

                           












HW#1 --- last modified February 07 2019 04:33:53..

Solution set.

Due date: Sep 9

Files to be submitted:
  Hw1.zip

Purpose:

To get our OpenGL Environment set-up and to write a first simple program using shaders.

Related Course Outcomes:

The main course outcomes covered by this assignment are:

LO3 -- Write an OpenGL program using shaders.

Specification: For this assignment, I would like you to go to the book's code website. There you will find a link to setting up OpenGL for Windows, Mac, and Linux. OSX uses a slightly older flavor of OpenGL. As I am not sure what platform the grader will be grading on, I want you to modify a base program that I know works on all three platforms. So download the zip file HelloWorld2D (new version) . As a first step, I would like you to get this program to compile on your machine. As an aside for Mac user's, rather than try to get the glew library to compile from sources, it might be easier to use Homebrew and then type:

brew install glew

In asst1.cpp on a Mac, I had to change the constant gl_GL2Compatible to true.

Once you have this program working, I next want you to modify it so that rather than just draw one rectangle with gradient colors and a texture image, it instead draws a 3x3 checkerboard pattern. The "dark squares" in this pattern should be the image from the original program. The "light squares" should not be textured but should be colored with a different gradient of colors. Finally, if the window is re-sized I would like all the squares in the checkerboard to remain squares not rectangles. I don't want the image to be cropped, but I would like the squares to get scaled if possible. Your program should not modify the call to glViewport, but is allowed to modify the vertex shader and the uniform variables that are used in the shader.

In the ZIP file that you submit make sure to include each of the files that was in the original project.

Point Breakdown

Code contributed to existing project is well-documented and follows the SJSU CS Department guidelines for C++1pt
Code compiles, opens a window with a 3x3 checkerboard pattern in it2pts
"Dark squares" are as described above2pts
"Light squares" are as described above2pts
Resizing works as described. (1pt resizes as squares, 1pt no cropping, 1pt uses vertex shaders)3pts
Total10pts